<template>
  <div class="batchGeneration">
    <el-dialog title="生成授权码" :visible.sync="dialogFormVisible">
      <div class="batchGeneration-header">
        生成数量:
        <el-input-number v-model="num" :controls="false" class="input"></el-input-number>
        <!-- <el-button type="primary" @click="generate">生成</el-button> -->
      </div>

      <!-- <div class="batchGeneration-table">
        <el-table
        :data="tableData"
        border
        v-loading="loading"
        style="width: 100%">
          <el-table-column
            v-for="item, index in tableList"
            :key="index"
            :prop="item.prop"
            :label="item.label"
            :align="'center'"

            >
          </el-table-column>
          <el-table-column label="操作" :align="'center'">
            <template slot-scope="scope">
              <el-button @click="delete(scope.row)" type="text" size="small">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="pagination">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="page"
            :page-sizes="[10, 20, 30]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="40">
          </el-pagination>
        </div>
        
      </div> -->

      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button :loading="loading" type="primary" @click="generate">生 成</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import request from '../../../utils/request';
export default {
  name: 'batchGeneration',
  data() {
    return {
      dialogFormVisible: false,
      loading: false,
      num: 0,
      page: 1,
      pageSize: 10,
      tableData:[
        { id: '250', code: '测试', time: '2024-4-30' }
      ],
      tableList: [
        { label: '授权码ID', prop: 'id' },
        { label: '授权码', prop: 'code' },
        { label: '生成时间', prop: 'time' },
      ]
    }
  },
  methods: {
    // 确定
    confirm() {
      dialogFormVisible = false
      
    },
    // 删除
    delete(row) {

    },
    // 生成
    generate () {
      this.loading = true;
      request({
        url: `/admin/auth-code/v1/batch-gen/${this.num}`,
        method: 'post',
        // params: {
        //   genNum: this.num
        // }
      }).then(res => {
        this.dialogFormVisible = false
        this.$message.success('操作成功');
        this.loading = false;
        this.$emit("batchgen")
      })
    },
    // 
    handleSizeChange() {

    },
    handleCurrentChange() {
      
    }
  },
}
</script>
<style scoped>
.batchGeneration-header {
  display: flex;
  align-items:center;
  margin-bottom: 30px;
}
.batchGeneration-header > .input {
  margin-left: 10px;
  margin-right: 15px;
}

</style>